#include <iostream>

#include <tws_debugging.h>
#include <xwritelogexport.h>
#include "xinfomattypeparserfactory.h"
#include "xinfomattypeparserbase.h"
#include "xinfomatiptypeparser.h"
#include "xinfomatmactypeparser.h"
#include "xinfomatlayouttypeparser.h"
#include "xinfomatversiontypeparser.h"
#include "xinfomatdeletefiletypeparser.h"
#include "xinfomatvolumetypeparser.h"
#include "xinfomattimeoutparser.h"      // 22Feb2011
#include "xinfomatscreenmodeparser.h"   // 22Feb2011

//#define _DEBUGING_

XInfomatTypeParserFactory::XInfomatTypeParserFactory()
    :m_typeParserBase(NULL)
{
}

XInfomatTypeParserBase*
XInfomatTypeParserFactory::createTypeParser(uint8_t uTypeId)
{
    if (NULL == m_typeParserBase)
	{
		DEBUG("Get into the type parser creation");
		switch (uTypeId)
        {
            case INFOMAT_TYPE_VERSION:
                m_typeParserBase = new XInfomatVersionTypeParser();
                break;
            
			case INFOMAT_TYPE_IP:
                m_typeParserBase = new XInfomatIpTypeParser();
                break;
  
            case INFOMAT_TYPE_MAC:
                m_typeParserBase = new XInfomatMacTypeParser();
                break;

			case INFOMAT_TYPE_LAYOUT:
                m_typeParserBase = new XInfomatLayoutTypeParser();
                break;

            case INFOMAT_TYPE_DELETE_FILE:
                m_typeParserBase = new XInfomatDeleteFileTypeParser();
                break;

            case INFOMAT_TYPE_VOLUME:
                m_typeParserBase = new XInfomatVolumeTypeParser();
                break;
			
			case INFOMAT_TYPE_TIMEOUT:
				LOG_T("Get Timeout Configuration Socket");
				m_typeParserBase = new XInfomatTimeoutParser();
				break;
			case INFOMAT_TYPE_SCREENMODE:
				LOG_T("Get Screen Mode Configuration Socket");
				m_typeParserBase = new XInfomatScreenModeParser();
				break;
			default:
				DEBUG("Factory: No such Type");
                return NULL;
        }
    }
	return m_typeParserBase;
}

/**
 @brief : it will not be called in fact.
 */
XInfomatTypeParserFactory::~XInfomatTypeParserFactory()
{
}
